﻿//Author: Jason Leber
//Purpose: Master Page JS File - Terms dialog, SubMenus
//Date: 11/27/2012
//Modifications: Work Item #, Who, When

$(document).ready(function () {

    // Mater Page
    $("#terms").dialog({
        autoOpen: false,
        height: 500,
        width: 750,
        modal: true,
        buttons: {
            "Close": function () {
                $(this).dialog("close");
            }
        }
    });

    $("#aTerms").click(function () {
        $("#terms").load("../../Pages/Terms/").dialog("open");
    });

    // Account Page
    $("#divAccount").hide();
    $("#divBillingShipping").hide();

    $("#aAccount").click(function () {
        $("#divBillingShipping").hide();
        $("#divAccount").show();
    });

    $("#aBillingShipping").click(function () {
        $("#divAccount").hide();
        $("#divBillingShipping").show();
    });

    if ($("input[id$='hfDisplay']").val() == "acct") {
        setTimeout(function () {
            $("#aAccount").trigger('click');
        }, 0);
    } else if ($("input[id$='hfDisplay']").val() == "bill") {
        setTimeout(function () {
            $("#aBillingShipping").trigger('click');
        }, 0);
    }

    // Cart Page
    $("input[id$='btnCheckout']").click(function () {
        window.open("../../Pages/Checkout/");
    });
});